package avicit.bdp.dms.tdm.utils;

import avicit.bdp.core.enums.BaseEnum;

public enum ReleaseStatus implements BaseEnum {
  WAIT_PUBLISH(0, "未发布"),
  PUBLISHED(1,"已发布"),
  REVOKED(2, "已撤回");

  ReleaseStatus(int code, String descp) {
    this.code = code;
    this.descp = descp;
  }

  private final int code;
  private final String descp;

  public static ReleaseStatus valueOf(int value) {
    for (ReleaseStatus approveStatus : values()) {
      if (approveStatus.getCode() == value) {
        return approveStatus;
      }
    }
    return null;
  }

  public static String getDescByCode(Integer code) {
    if (code != null) {
      ReleaseStatus[] values = ReleaseStatus.values();
      for (ReleaseStatus obj : values) {
        if (obj.getCode() == code) {
          return obj.getDescp();
        }
      }
    }

    return null;
  }

  public int getCode() {
    return code;
  }

  public String getDescp() {
    return descp;
  }

}
